<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    {$LOAD_STYLE.top|raw}
</head>
<style>
	.zi{
		font-size: 18px !important;
	}
</style>
	<body class="pear-container">
		
		<div class="layui-card">
			<div class="layui-card-body">
				<table id="dataTable" lay-filter="dataTable"></table>
			</div>
		</div>
		
        <script type="text/html" id="toolbar">
			产品差价表
        </script>
		
	   <script type="text/html" id="status">
		   <input type="checkbox" name="status" value="{{d.id}}" lay-skin="switch" lay-text="启用|禁用" lay-filter="status" {{# if(d.status==1){ }} checked {{# } }}>
	   </script>
	   <script type="text/html" id="wx_isshow">
		   <input type="checkbox" name="wx_isshow" value="{{d.id}}" lay-skin="switch" lay-text="显示|隐藏" lay-filter="wx_isshow" {{# if(d.wx_isshow==1){ }} checked {{# } }}>
	   </script>

		<script type="text/html" id="options">
		<div class="layui-options">
			<button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i class="layui-icon layui-icon-edit"></i></button>
			<button class="pear-btn pear-btn-warming pear-btn-sm" lay-event="color"><i class="layui-icon layui-icon-theme"></i></button>
		    <button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i class="layui-icon layui-icon-delete"></i></button>
		</div>
		</script>

		<script type="text/html" id="l_profit1">
		  {{#  if(d.f_profit1 < 1.2){ }}
		    <label style="color:#CC0000" class="zi">{{d.f_profit1}}</label>
		  {{#  } else if(d.f_profit1 > 1.5){ }}
		    <label style="color:#269E26" class="zi">{{d.f_profit1}}</label>
		  {{# } else { }}
			<label class="zi">{{d.f_profit1}}</label>
		  {{# } }}
		</script>
		
		<script type="text/html" id="l_profit2">
		  {{#  if(d.f_profit2 > 1.2){ }}
		    <label style="color:#269E26" class="zi">{{d.f_profit2}}</label>
		  {{#  } else if(d.f_profit2 <= 1.2 && d.f_profit2 > 0){ }}
		    <label style="color:#FF9800" class="zi">{{d.f_profit2}}</label>
		  {{#  } else if(d.f_profit2 < 0){ }}
		   <label style="color:#CC0000" class="zi">{{d.f_profit2}}</label>
		  {{# } else { }}
			<label class="zi">{{d.f_profit2}}</label>
		  {{# } }}
		</script>
		
        <script>
        layui.use(['table', 'form', 'jquery','common','laydate','topBar'], function() {
            let table = layui.table;
            let form = layui.form;
            let $ = layui.jquery;
            let common = layui.common;
            let laydate = layui.laydate;
            let MODULE_PATH = "{$MODULE_PATH}";
            
            let cols = [
                [{
				      field: "number",
				      title: "编号",
					  width: 80,
					  sort:	true,
				      unresize: "true",
				      align: "center",
				   }, {
                       field: "title",
                       title: "品名",
					   width: 250,
                       unresize: "true",
                       align: "left",
                   }, {
                       field: "l_profit1",
                       title: "利润",
					   sort:	true,
					   width: 120,
					   templet:'#l_profit1',
                       unresize: "true",
                       align: "center"  
                   }, {
                       field: "l_profit2",
                       title: "参考利润",
					   width: 100,
					   sort:	true,
					   templet:'#l_profit2',
                       unresize: "true",
                       align: "center"
				   }, {
				       field: "price1",
				       title: "零售价",
					   width: 100,
				       unresize: "true",
					   hide : "true",
				       align: "center"
				   }, {
                       field: "ckprice1",
                       title: "参考价",
					   width: 100,
                       unresize: "true",
                       align: "center"
					}, {
                       field: "space1",
                       title: "进货价",
					   width: 100,
                       unresize: "true",
                       align: "center"
                   }, {
					
                       field: "markup",
                       title: "零售加价",
                       unresize: "true",
                       align: "center"
				   }, {
				       field: "markup2",
				       title: "二批加价",
				       unresize: "true",
				       align: "center"
                   }
                ]
            ]
			
			table.render({
				elem: '#dataTable',
				url: MODULE_PATH + 'cost',
				page: true,
				cols: cols,
				cellMinWidth: 100,
				even:true,
				limit:30,
				title:"产品差价表",
				toolbar: '#toolbar',
				defaultToolbar: [{
					title: '刷新',
					layEvent: 'refresh',
					icon: 'layui-icon-refresh',
				}, 'filter', 'print', 'exports']
			});
			
        })		
    </script>
	{$LOAD_STYLE.bottom|raw}
	</body>
</html>
